package com.edu.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.edu.annotation.CreateBy;
import com.edu.annotation.CreateTime;
import com.edu.annotation.UpdateBy;
import com.edu.annotation.UpdateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @ClassName BaseEntity
 * @Description
 * @Author W.Jian
 * @Date 2021/5/7 10:55
 **/
public class BaseEntity {
    /**
     * id
     */
    @TableId(value = "id", type = IdType.AUTO)	//指定主键生成策略
    private Long id;

    /**
     * 创建人
     */
    @CreateBy
    protected String createBy;

    /**
     * 修改人
     */
    @UpdateBy
    protected String updateBy;

    /**
     * 创建时间
     */
    @CreateTime
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    protected Date createTime;

    /**
     * 修改时间
     */
    @UpdateTime
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    protected Date updateTime;


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public String toString() {
        return "BaseEntity{" +
                "id=" + id +
                ", createBy=" + createBy +
                ", updateBy=" + updateBy +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                '}';
    }
}
